//
//  JDStatusForwardCell.swift
//  JDWeiBo
//
//  Created by apple on 15/7/5.
//  Copyright © 2015年 apple. All rights reserved.
//

import UIKit

class JDStatusForwardCell: JDStatusCell {

    override init(style: UITableViewCellStyle, reuseIdentifier: String?) {
        super.init(style: style, reuseIdentifier: reuseIdentifier)
        
        // 初始化转发微博标签
        forwardLabel = {
            
            let label = UILabel()
            label.textColor = UIColor.darkGrayColor()
            label.font = UIFont.systemFontOfSize(14)
            label.numberOfLines = 0
            
            return label
            }()
        forwardLabel!.preferredMaxLayoutWidth = UIScreen.mainScreen().bounds.width - 16
        insertSubview(forwardLabel!, atIndex: 0)
        
        forwardButton.backgroundColor = UIColor(white: 0.9, alpha: 1.0)
        insertSubview(forwardButton, atIndex: 0)
        
        // 自动布局
        // 背景按钮
        forwardButton.ff_AlignVertical(ff_AlignType.BottomLeft, referView: contentLabel, size: nil, offset: CGPoint(x: -12, y: 12))
        forwardButton.ff_AlignVertical(ff_AlignType.TopRight, referView: footerView, size: nil)
        // 转发文字
        forwardLabel!.ff_AlignInner(ff_AlignType.TopLeft, referView: forwardButton, size: nil, offset: CGPoint(x: 12, y: 12))
        
        // 配图视图
        let cons = pictureView.ff_AlignVertical(ff_AlignType.BottomLeft, referView: forwardLabel!, size: CGSizeMake(290, 90), offset: CGPoint(x: 0, y: 12))
        // 记录宽高约束
        widthCons = pictureView.ff_Constraint(cons, attribute: NSLayoutAttribute.Width)
        heighCons = pictureView.ff_Constraint(cons, attribute: NSLayoutAttribute.Height)
    }
    
    required init(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    // MARK: 懒加载控件
    lazy var forwardButton = UIButton()
}
